
import isg.etsii.ull.es.*;
import isg.etsii.ull.es.DAO.*;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Servlet implementation class ServletPropiedad
 */
public class ServletAnuncio extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ServletAnuncio() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		ServletAnuncio Miserv = new ServletAnuncio ();
		
		try {
			Miserv.InsertarAnuncio(response, request);
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}				
	}
    protected void InsertarAnuncio (HttpServletResponse res, HttpServletRequest request)throws IOException, ClassNotFoundException, SQLException, ServletException{
	
	/*AnuncioDAO anuDAO = new AnuncioDAO();// aki esta el error!!
	Anuncio a = new Anuncio (); 
	a.setDni(request.getParameter("dni"));
	a.setIdPropiedad(1);
	a.setIdPropiedad(p.getIdPropiead());
	a.setFInicial(request.getParameter("FInicial"));
	a.setFFinal((request.getParameter("FFinal")));
    try {
	anuDAO.nuevo(a);
    }catch (SQLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	HttpSession session = request.getSession();
    session.setAttribute("a", a);
		
		
		dispatcher.forward(request,res);*/
    	RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/Index.jsp");
}

}
